home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 October: Technology Seed / ADC Seed CD - October 1999.toast / FireWire / FireWire_2.1_SDK_DR3 / Source / OpenTransport / FWOTDriver / HWSpecific.h < prev   
Encoding:
C/C++ Source or Header  |  1999-05-17  |  5.7 KB  |  171 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        HWSpecific.h
  3.  
  4.     Contains:    This file contains macros and structures for the ABC Vendor
  5.                 Ethernet DLPI.
  6.  
  7.     Written by:    
  8.  
  9.     Copyright:    © 1993-1994, 1996-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.     Change History (most recent first):
  12.  
  13.        <FW8>      1/9/97    ES        Took out some debugging stuff. Removed fixed address allocation.
  14.        <FW7>    12/27/96    ES        Changed fwDriverID to fwUnitID and added unitConnection flag to
  15.                                     DLPIPrivateData.
  16.        <FW6>    12/27/96    ES        Changed a bunch of "FWDriver"s to "FWClient"s. Changed to
  17.                                     protocol driver.
  18.        <FW5>     8/26/96    ES        Changed to new command object interface.
  19.        <FW4>     6/20/96    ES        Made this look more like a .i generated interface.
  20.        <FW3>     3/29/96    ES        Removed all debug strs.
  21.        <FW2>     3/29/96    ES        Changed debug str defines so we don't get compiler warnings.
  22.                                     Took out some unused defs.
  23.        <FW1>     3/27/96    ES        first checked in
  24.  
  25.     To Do:
  26. */
  27.  
  28. #ifndef __HWSPECIFIC__
  29. #define __HWSPECIFIC__
  30.  
  31. #ifndef __FIREWIRE__
  32. #include <FireWire.h>
  33. #endif
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_IMPORT_SUPPORTED
  40. #pragma import on
  41. #endif
  42.  
  43. #if PRAGMA_ALIGN_SUPPORTED
  44. #pragma options align=mac68k
  45. #endif
  46.  
  47. /*zzz*/
  48. #define DebugStrErr(x) strlen ((const char *) x)
  49. //zzz#define DebugStrErr(x) DebugStr ((ConstStr255Param) x)
  50.  
  51. #define DebugStr1(x) strlen ((const char *) x)
  52. //zzz#define DebugStr1(x) DebugStr ((ConstStr255Param) x)
  53.  
  54. #define DebugStr2(x) strlen ((const char *) x)
  55. //zzz#define DebugStr2(x) DebugStr ((ConstStr255Param) x)
  56. /*zzz*/
  57.  
  58. #define kPCIDeviceInfoName        "\pfw617070,6f7464"    // pascal string,vendor ID & device id
  59. #define kModuleDeviceInfoName    "fw617070,6f7464"        // c string, vendor ID & device id
  60. #define kModuleDriverFragName    "\pOTModl$fw617070,6f7464"
  61.  
  62. enum
  63. {
  64.     kMaxTransmitSize        = 900
  65. };
  66.  
  67. //-----------------------------------------------------------------------------------------
  68. //    Generic enums
  69. //-----------------------------------------------------------------------------------------
  70.  
  71. enum BooleanStates
  72.     {
  73.     kFalse    = 0,
  74.     kTrue    = 1
  75.     };
  76.  
  77. enum InterruptStates
  78.     {
  79.     kNoInterrupts            = 0,
  80.     kTxInterrupts            = 1,
  81.     kRxInterrupts            = 2,
  82.     kBothTxRxInterrupts        = 3
  83.     };
  84.  
  85. //-----------------------------------------------------------------------------------------
  86. // Private driver flags for privateFlags variable in dlpiPrivateData
  87. //-----------------------------------------------------------------------------------------
  88. #define kpfFraming8022                0x00000001
  89.  
  90. //-----------------------------------------------------------------------------------------
  91. //    DLPI Private Data structure
  92. //-----------------------------------------------------------------------------------------
  93.  
  94. struct DLPITransmitPacketCommandStruct
  95. {
  96.     struct DLPITransmitPacketCommandStruct
  97.                         *pNextDLPITransmitPacketCommand;
  98.     Ptr                    transmitBuffer;
  99.     UInt32                packetSize;
  100. };
  101. typedef struct DLPITransmitPacketCommandStruct    DLPITransmitPacketCommand, *DLPITransmitPacketCommandPtr;
  102.  
  103. struct DLPIPrivateData
  104.     {
  105.     UInt32                privateFlags;                // 32 1 bit flags for driver usage
  106.     QHdr                dlpiStreamsQueue;            // linked list of active streams
  107.     QHdr                RxPacketQueue;                // linked list of received packets
  108.     QHdr                TxPacketQueue;                // linked list of packets to transmit
  109.     UInt8                ourEAddress[6];                // store our Ethernet address
  110.     SInt32                TxDeferredTaskCookie;
  111.     SInt32                RxDeferredTaskCookie;
  112.     RegEntryID            nodeEntryID;                // our entry in the Name Registry
  113.     UInt32                cardBaseAddr;                // only necessary for memory mapped cards
  114.     UInt16                currentMinorDeviceNumber;    // minor device number used in open
  115.     QHdrPtr                transmitPacketQueue;        // Queued transmit packet commands.
  116.     FWCommandObjectID    asynchCommandObjectID;        // Command object for sending FireWire asynchronous packets.
  117.     FWUnitID            fwUnitID;                    // ID of connected FireWire unit.
  118.     Boolean                unitConnection;                // True if we've added a connection to unit.
  119.     FWPDriverID            fwPDriverID;                // ID of this FireWire protocol driver.
  120.     FWAddress            localAddress,                // Local write address.
  121.                         targetAddress;                // Target write address.
  122.     Ptr                    transmitBuffer;                // Buffer used for transmission.
  123.     Ptr                    receiveBuffer;                // Buffer used for reception.
  124.     UInt32                rxInterruptsOn;                // Receive interrupts are on.
  125.     UInt32                txInterruptsOn;                // Transmit interrupts are on.
  126.     };
  127.  
  128. typedef struct DLPIPrivateData DLPIPrivateData;        
  129.     
  130. //-----------------------------------------------------------------------------------------
  131. //    Function Prototypes
  132. //-----------------------------------------------------------------------------------------
  133.  
  134. void EnqueueElementAtHead(QHdr *theQHdr, QElem *theElem, UInt16 whichIntsOff);
  135. void EnqueueElement(QHdr *theQHdr, QElem *theElem, UInt16 whichIntsOff);
  136. QElem *DequeueHead(QHdr *theHdr, UInt16 whichIntsOff);
  137. QElem *DequeueElement(QHdr *theQHdr, QElem *theElem, UInt16 whichIntsOff);
  138.  
  139.  
  140. Boolean ABCVendorIsThisOurCard(RegEntryID *theID, UInt32 cardAddress);
  141. void ABCVendorDisableInterrupts(UInt16 whichIntsOff);
  142. void ABCVendorEnableInterrupts(UInt16 whichIntsOn);
  143. SInt32 ABCVendorRegisterMulticast(UInt8 *mcAddress);
  144. SInt32 ABCVendorUnregisterMulticast(UInt8 *mcAddress);
  145. void ABCVendorInitialize(RegEntryID *theID);
  146. void ABCVendorClose(void);
  147. void ABCVendorTransmitOnePacket(mblk_t *thePacket, UInt16 packetSize);
  148. OSErr ABCVendorCheckTransmitterStatus(UInt16 packetSize);
  149. SInt32 ABCVendorSetEthernetAddress(UInt8 *physicalAddress);
  150. void ABCVendorGetFactoryEthernetAddress(UInt8 *addressArray);
  151. InterruptMemberNumber ABCVendorISR(InterruptSetMember member, void *refCon, UInt32 theIntCount);
  152.  
  153. void ABCVendorTransmitCompletion (
  154.     FWCommandObjectID        fwCommandObjectID,
  155.     OSStatus                commandStatus,
  156.     UInt32                    completionProcData);
  157.  
  158. #if PRAGMA_ALIGN_SUPPORTED
  159. #pragma options align=reset
  160. #endif
  161.  
  162. #if PRAGMA_IMPORT_SUPPORTED
  163. #pragma import off
  164. #endif
  165.  
  166. #ifdef __cplusplus
  167. }
  168. #endif
  169.  
  170. #endif /* __HWSPECIFIC__ */
  171.